<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <title>后台管理 -  文章列表</title>

    <meta name="keywords" content="{$Think.CONFIG.keywords}" />
    <meta name="description" content="{$Think.CONFIG.description}" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

    <include file="Public/head" />
</head>

<body class="no-skin">
<include file="Public/header" />
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
    </script>

    <include file="Public/sidebar" />
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs" />

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set" />

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12" style="width:50%;">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <a class="btn btn-info" href="{:U('article_add')}?cate_id={$cate_id}" value="">新增</a>
                        </div>
                        <div class="space-4"></div>
                        <div class="row">
                            <form id="form" method="post" action="{:U('del')}">
                                <table class="table table-striped table-bordered table-hover " id="dynamic-table">
                                    <thead>
                                    <tr>
                                        <th class="center"><input class="check-all" type="checkbox" value=""></th>
                                        <th class="hidden-sm hidden-xs">ID</th>
                                        <th class="hidden-sm hidden-xs">文章标题</th>
                                        <th class="center">所属二级分类</th>
                                        <th class="center">图片</th>
                                        <th class="center">简介</th>
                                        <th class="center">时间</th>
                                        <th class="center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <volist name="list" id="val">
                                        <tr>
                                            <td class="center">
                                                <input class="ids" type="checkbox" name="ids[]" value="{$val['id']}">
                                            </td>
                                            <td class="center">{$val['id']}</td>
                                            <td class="center">{$val['title']}</td>
                                            <td class="center">{$val['article_cate_name']}</td>
                                            <td class="center"><img src="{$val['picture']}" style="width:20%;"></td>
                                            <td class="center">{$val['content']}</td>
                                            <td class="center">{$val['add_time']}</td>
                                            <td class="center"><a href="{:U('article_edit')}?id={$val['id']}&cate={$val['article_cate_name']}">修改</a>&nbsp;
                                                <a class="del" href="javascript:;" val="{:U('article_del')}?id={$val['id']}&cate_id={$val['article_cate_id']}" title="删除">删除</a>
                                            </td>
                                        </tr>
                                    </volist>
                                    </tbody>
                                </table>
                            </form>
                            <div class="cf">
                                <span class="pages">{$page}</span>
                                <input id="submit" class="btn btn-info" type="button" value="删除">
                                &nbsp;&nbsp;&nbsp;
                                <input id="res" onclick='fan();' class="btn btn-info" type="button" value="返回">
                            </div>
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer" />

</div><!-- /.main-container -->

<include file="Public/footerjs" />
<!-- inline scripts related to this page -->
<script type="text/javascript">
    function fan(){
        var urls = "{:U('SucList/index')}";
        window.location.href=urls;
    }
    $(function(){
        $(".group").click(function(){
            $(this).addClass('hide');
            $(this).parent().find(".groupselect").removeClass('hide');
        })
        $(".groupselect").on("change",function(){
            var ob = $(this);
            var gid=ob.val();
            var id = ob.parent().find('.group').attr('val');
            $.get("{:U('update')}?ajax=yes&id="+id+"&gid="+gid,function(data){
                var text = ob.find("option:selected").text();
                ob.parent().find(".group").removeClass('hide').html(text);
                ob.addClass('hide');
            });
        })

        $(".check-all").click(function(){
            $(".ids").prop("checked", this.checked);
        });
        $(".ids").click(function(){
            var option = $(".ids");
            option.each(function(i){
                if(!this.checked){
                    $(".check-all").prop("checked", false);
                    return false;
                }else{
                    $(".check-all").prop("checked", true);
                }
            });
        });
        $("#submit").click(function(){
            bootbox.confirm({
                title: "系统提示",
                message: "子分类也将一并删除，是否要删除所选文章分类？",
                callback:function(result){
                    if(result){
                        $("#form").submit();
                    }
                },
                buttons: {
                    "cancel" : {"label" : "取消"},
                    "confirm" : {
                        "label" : "确定",
                        "className" : "btn-danger"
                    }
                }
            });
        });
        $(".del").click(function(){
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "确认删除该文章?",
                callback:function(result){
                    if(result){
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel" : {"label" : "取消"},
                    "confirm" : {
                        "label" : "确定",
                        "className" : "btn-danger"
                    }
                }
            });
        });
    })
</script>
</body>
</html>
